<%--
  Created by IntelliJ IDEA.
  User: mr.chan
  Date: 2020-10-29
  Time: 16:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--导入jstl标准标签库--%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%--设置不要忽略 EL表达式--%>
<%@page isELIgnored="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
    <title>易买网 - 首页</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css"/>
    <script type="text/javascript" src="scripts/function.js"></script>
</head>
<body>
<div id="header" class="wrap">
    <div id="logo"><img src="${pageContext.request.contextPath}/images/logo.gif"/></div>
    <div class="help">
        <c:if test="${userName!=null}">
            <marquee>
                亲 ${userName} 欢迎回来
            </marquee>
        </c:if>
        <a href="#" class="shopping">购物车</a>
        <a href="${pageContext.request.contextPath}/login/to_login">登录</a>
        <a href="${pageContext.request.contextPath}/login/to_reg">注册</a><a href="guestbook.html">留言</a></div>
    <div class="navbar">
        <ul class="clearfix">
            <li class="current"><a href="#">首页</a></li>
            <li><a href="#">图书</a></li>
            <li><a href="#">百货</a></li>
            <li><a href="#">品牌</a></li>
            <li><a href="#">促销</a></li>
        </ul>
    </div>
</div>
<div id="childNav">
    <div class="wrap">
        <ul class="clearfix">
            <li class="first"><a href="#">音乐</a></li>
            <li><a href="#">影视</a></li>
            <li><a href="#">少儿</a></li>
            <li><a href="#">动漫</a></li>
            <li><a href="#">小说</a></li>
            <li><a href="#">外语</a></li>
            <li><a href="#">数码相机</a></li>
            <li><a href="#">笔记本</a></li>
            <li class="last"><a href="#">Investor Relations</a></li>
        </ul>
    </div>
</div>
<div id="main" class="wrap">
    <div class="lefter">
        <div class="box">
            <h2>商品分类</h2>
            <dl>
                <%--                for(EbProductCategory big: bigs){--%>
                <%--                    //显示大类名称--%>
                <%--                    System.out.println(big.getEpcName());--%>
                <%--                    //显示属于该大类的小类--%>
                <%--                    for(EbProductCategory small:smalls){--%>
                <%--                        //                if(你属于上面你的大类){--%>
                <%--                        if(small.getEpcParentId().equals(big.getEpcId())){--%>
                <%--                            System.out.println("\t"+small.getEpcName());--%>
                <%--                        }--%>
                <%--                    }--%>
                <%--                }--%>
                <c:forEach items="${categoryMap.bigs}" var="big">

                    <dt>${big.epcName}</dt>
                    <c:forEach items="${categoryMap.smalls}" var="small">
                        <c:if test="${big.epcId == small.epcParentId}">
                            <dd>
                                <a href="${pageContext.request.contextPath}/product/product_list?epc_child_id=${small.epcId}">${small.epcName}</a>
                            </dd>
                        </c:if>
                    </c:forEach>

                </c:forEach>
            </dl>
        </div>
        <div class="spacer"></div>
        <div class="last-view">
            <h2>最近浏览</h2>
            <dl class="clearfix">
                <dt><img src="${pageContext.request.contextPath}/images/product/0_tiny.gif"/></dt>
                <dd><a href="product-view.html">法国德菲丝松露精品巧克力500g/盒</a></dd>
                <dt><img src="${pageContext.request.contextPath}/images/product/0_tiny.gif"/></dt>
                <dd><a href="product-view.html">法国德菲丝松露精品巧克力500g/盒</a></dd>
            </dl>
        </div>
    </div>
    <div class="main">
        <div style="text-align: center;">
            <form action="${pageContext.request.contextPath}/product/search" method="post">
                <input type="text" name="searchText" style="line-height: 25px;width: 300px;"/>
                <input type="submit" value="查询" style="height: 30px;width: 100px;background: #fc7e31;color: white;font-size: 18px;"/>
            </form>
        </div>
        <div class="price-off">
            <h2>商品列表</h2>
            <ul class="product clearfix">

                <c:forEach items="${products}" var="product">
                    <li>
                        <dl>
                            <dt><a href="${pageContext.request.contextPath}/product/detail?epId=${product.epId}"
                                   target="_blank">
                                <img src="${pageContext.request.contextPath}/images/product/${product.epFileName}"/></a>
                            </dt>
                            <dd class="title"><a
                                    href="${pageContext.request.contextPath}/product/detail?epId=${product.epId}"
                                    target="_blank">${product.epName}</a></dd>
                            <dd class="price">￥${product.epPrice}</dd>
                        </dl>
                    </li>
                </c:forEach>

            </ul>

            <div class="pager">

                <ul class="clearfix">
                    <li class="current">1</li>
                    <li><a href="#">2</a></li>
                </ul>
            </div>

        </div>
        <div class="side">
            <div class="spacer"></div>
            <div class="news-list">
                <h4>新闻动态</h4>
                <ul>
                    <%--
                                            items:必须是model存的数据的key
                                            var:用于临时存放从集合中取出一个新闻对象
                    --%>
                    <c:forEach var="news" items="${newes}">
                        <li><a href="${pageContext.request.contextPath}/news/detail?enId=${news.enId}"
                               target="_blank">${news.enTitle}</a></li>
                    </c:forEach>

                </ul>

            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>
<div id="footer">
    Copyright &copy; 2016 湖南软测信息技术有限公司 All Rights Reserved. 湘ICP证1001号
</div>
</body>
</html>
